﻿<%@page import="com.yunzhong.appointment.config.SessionConst"%>
<%@page import="com.yunzhong.appointment.entity.SysMenu"%>


<%@page import="org.apache.shiro.subject.Subject"%>
<%@page import="org.apache.shiro.SecurityUtils"%>
<%@ page import="com.alibaba.druid.sql.visitor.functions.Substring" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>
<%@taglib uri="http://shiro.apache.org/tags" prefix="shiro" %>
<%@include file="../common/common.jsp"%>
<html>
	<head>
		<link rel="stylesheet" type="text/css" href="../../../static/css/bootstrap.min.css"/>
		<script type="text/javascript" src="../../../static/js/jquery-2.2.4.min.js"></script>
		<script type="text/javascript" src="../../../static/js/jquery.tips.js"></script>
		<script type="text/javascript" src="../../../static/js/bootstrap.min.js" ></script>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>云众科技网上预约挂号系统</title>
	</head>
	<style>
		html body{
			width: 100%;
		}
		.piaoyikuang{
			border: 1px solid #66AFE9;
			border-radius: 10px;
		}
		.piaoyi{
			float: left;
			width: 100px;
			height: 30px;
			border: 0px solid #66AFE9;
			text-align: center;
		}
		.ks-left{
			border: 1px solid #66AFE9;
			border-radius: 10px;
			margin-right: 0px;
		}
		.ks-right{
			border: 0px solid #66AFE9;
			border-radius: 10px;
		}
	</style>
	<body>
		<!--
        	作者：石洪刚
        	时间：2017年10月26日11:44:45
        	描述：个人中心
        -->

        <div class="main-container" id="main-container" style="margin-top: 10px;">

			<form enctype="multipart/form-data" id="form1"  name="infoForm" action="javascript:doSub()" method="post">
				<c:if test="${person==null and pat==null}">
					暂无信息
				</c:if>
				<input type="hidden" name="patientId" value="${pat.patientId}">
				<div style="position:absolute;width:632px;margin: 0 auto;text-align:center" >
					<div align="center">
					<c:if test="${pat!=null and pat.patientPic==null or pat.patientPic==''}">
							<img id="image" src="<%=request.getContextPath()%>/static/img/bianque.jpg" width="200" height="200">
							<input type="file"   name="pic" onchange="yuLan(this,'image','preview')" >
							<button class="btn btn-warning" onclick="uploadPhoto()">上传头像</button>
					</c:if>
					</div>
					<div align="center">
					<c:if test="${pat!=null and pat.patientPic!=null and pat.patientPic!=''}">
						<img id="image" src="/base/download?url=${pat.patientPic}" width="200" height="200">
						<input type="file" name="pic" onchange="yuLan(this,'image','preview')" >
						<button class="btn btn-warning" onclick="uploadPhoto()">上传头像</button>
					</c:if>
					</div>

			</div>


				<div class="form-group" style="position:absolute;right: 0px;top: 30px">
<%--					<img id="images" src="<%=request.getContextPath() %>/upload/${list.hyPic}" width="130" height="150">--%>
<%--					<input type="file" name="pic" onchange="yuLan(this,'image','preview')" >--%>
				</div>

			</form>
        </div>


	</body>
	<script type="text/javascript">

		//上传头像
		function uploadPhoto(){
			bootbox.confirm("确认上传吗?",function(r){
				if(r){
					var formData = new FormData(document.getElementById("form1"));
					var url = "/personal/edithead";
					$.ajax({
						type: 'post',
						url: url,
						data: formData,
						cache: false,
						processData: false,
						contentType: false,
						success:function (data) {
							if(data.success){
								bootbox.alert("上传成功",function(){
									location.href = "/personal/head";
								})

							}else {
								bootbox.alert("上传失败");
							}

						}
					})
				}
			});
		}

		<%--function doSub(){--%>

		<%--	bootbox.confirm("确认保存吗?",function(r){--%>
		<%--		if(r){--%>
		<%--			zg.wait("open");--%>
		<%--			var formData = new FormData(document.getElementById("form1"));--%>
		<%--			var url = "/vip/editsave";--%>
		<%--			$.ajax({--%>
		<%--				type: 'post',--%>
		<%--				url: url,--%>
		<%--				data: formData,--%>
		<%--				cache: false,--%>
		<%--				processData: false,--%>
		<%--				contentType: false,--%>
		<%--				success:function (data) {--%>
		<%--					if(data.success){--%>
		<%--						bootbox.alert("修改成功",function(){--%>
		<%--							location.href = "/vip/query?pageNum=${pageNum}";--%>
		<%--						})--%>

		<%--					}else {--%>
		<%--						bootbox.alert("修改失败");--%>
		<%--					}--%>

		<%--				}--%>
		<%--			})--%>
		<%--		}--%>
		<%--	});--%>
		<%--}--%>
	</script>
</html>
